#ifndef __RTCSinterface_H_
#define __RTCSinterface_H_

// base macro define 
#define		RTCS_CmdMsg				0x0
#define		RTCS_RespMsg			0x20000000
#define		RTCS_EvtMsg				0x40000000
#define		RTCS_BdctMsg			0x60000000
// end base macro define

#define		RTCS_ZipMsg				0x7E7E7E7E
#define		RTCS_ZipMsgKey			0x00FFFF00

//	public macro to create msg
#define		RTCS_MakeCmdMsg(interfaceid,msgid)		(RTCS_CmdMsg | ((interfaceid) << 15) | (msgid))
#define		RTCS_MakeRespMsg(interfaceid,msgid)		(RTCS_RespMsg | ((interfaceid) << 15) | (msgid))
#define		RTCS_MakeEvtMsg(interfaceid,msgid)		(RTCS_EvtMsg | ((interfaceid) << 15) | (msgid))
#define		RTCS_MakeBdctMsg(interfaceid,msgid)		(RTCS_BdctMsg | ((interfaceid) << 15) | (msgid))
//  end public macro to create msg

//  public macro to create key
#define		RTCS_MakeKey(interfaceid, keyid)		(((interfaceid) << 16) | (keyid))
//  end public macro to create key

// interface define 
// Max interface id is 16384
#define  	IRTCSBaseInterface			0
#define  	IRTCSAppInterface			50
// Max RTCS interface id is 50
#define		IClientBase				IRTCSBaseInterface + 1
#define		IRTCSConfig				IRTCSBaseInterface + 2
#define		IBusAction				IRTCSBaseInterface + 3
#define		ICSMaintain				IRTCSBaseInterface + 4
#define     IAlarm                  IRTCSBaseInterface + 5
// end interface define

// interface IClientBase macro
#define		IClientBaseCmdMsg(msgid)		RTCS_MakeCmdMsg(IClientBase, (msgid))			
#define		IClientBaseRespMsg(msgid)		RTCS_MakeRespMsg(IClientBase, (msgid))
#define		IClientBaseEvtMsg(msgid)		RTCS_MakeEvtMsg(IClientBase, (msgid))
#define		IClientBaseBdctMsg(msgid)		RTCS_MakeBdctMsg(IClientBase, (msgid))

#define		IClientBaseKey(keyid)			RTCS_MakeKey(IClientBase, (keyid))
//end interface IClientBase macro

// interface IRTCSConfig macro
#define		IRTCSConfigCmdMsg(msgid)		RTCS_MakeCmdMsg(IRTCSConfig, (msgid))			
#define		IRTCSConfigRespMsg(msgid)		RTCS_MakeRespMsg(IRTCSConfig, (msgid))
#define		IRTCSConfigEvtMsg(msgid)		RTCS_MakeEvtMsg(IRTCSConfig, (msgid))
#define		IRTCSConfigBdctMsg(msgid)		RTCS_MakeBdctMsg(IRTCSConfig, (msgid))

#define		IRTCSConfigKey(keyid)			RTCS_MakeKey(IRTCSConfig, (keyid))
//end interface IRTCSConfig macro

// interface IBusAction macro
#define		IBusActionCmdMsg(msgid)			RTCS_MakeCmdMsg(IBusAction, (msgid))			
#define		IBusActionRespMsg(msgid)		RTCS_MakeRespMsg(IBusAction, (msgid))
#define		IBusActionEvtMsg(msgid)			RTCS_MakeEvtMsg(IBusAction, (msgid))
#define		IBusActionBdctMsg(msgid)		RTCS_MakeBdctMsg(IBusAction, (msgid))

#define		IBusActionKey(keyid)			RTCS_MakeKey(IBusAction, (keyid))
//end interface IBusAction macro

// interface ICSMaintain macro
#define		Is_ICSMaintainMsg(msgid)		(!((0x1FFF8000&(msgid))^(ICSMaintain<<15)))

#define		ICSMaintainCmdMsg(msgid)		RTCS_MakeCmdMsg(ICSMaintain, (msgid))			
#define		ICSMaintainRespMsg(msgid)		RTCS_MakeRespMsg(ICSMaintain, (msgid))
#define		ICSMaintainEvtMsg(msgid)		RTCS_MakeEvtMsg(ICSMaintain, (msgid))
#define		ICSMaintainBdctMsg(msgid)		RTCS_MakeBdctMsg(ICSMaintain, (msgid))

#define		ICSMaintainKey(keyid)			RTCS_MakeKey(ICSMaintain, (keyid))
//end interface ICSMaintain macro

// interface IAlarm macro
#define		IAlarmCmdMsg(msgid)				RTCS_MakeCmdMsg(IAlarm, (msgid))
#define		IAlarmRespMsg(msgid)			RTCS_MakeRespMsg(IAlarm, (msgid))
#define		IAlarmEvtMsg(msgid)				RTCS_MakeEvtMsg(IAlarm, (msgid))
#define		IAlarmBdctMsg(msgid)			RTCS_MakeBdctMsg(IAlarm, (msgid))

#define		IAlarmKey(keyid)				RTCS_MakeKey(IAlarm, (keyid))
// end....

#endif
